[Add a label to a Node]
$ kubectl get nodes --show-labels
NAME      STATUS    ROLES    AGE     VERSION        LABELS
worker0   Ready     <none>   1d      v1.13.0        ...,kubernetes.io/hostname=worker0
worker1   Ready     <none>   1d      v1.13.0        ...,kubernetes.io/hostname=worker1
worker2   Ready     <none>   1d      v1.13.0        ...,kubernetes.io/hostname=worker2

[Choose one of the nodes, and add a label to it]
$ kubectl label nodes NODE_NAME disktype=ssd

[Verify that chosen node has a disktype=ssd label]
$ kubectl get nodes --show-labels
NAME      STATUS    ROLES    AGE     VERSION        LABELS
worker0   Ready     <none>   1d      v1.13.0        ...,disktype=ssd,kubernetes.io/hostname=worker0
worker1   Ready     <none>   1d      v1.13.0        ...,kubernetes.io/hostname=worker1
worker2   Ready     <none>   1d      v1.13.0        ...,kubernetes.io/hostname=worker2

So can see that the worker0 node has a disktype=ssd label.


➤ Create a pod that gets scheduled to the chosen node

[Create a Pod that will get scheduled on chosen node]
$ kubectl apply -f Pod_1.yaml
$ kubectl apply -f https://k8s.io/examples/pods/pod-nginx.yaml

[Verify that the pod is running on chosen node]
$ kubectl get pods --output=wide
NAME     READY     STATUS    RESTARTS   AGE    IP           NODE
nginx    1/1       Running   0          13s    10.200.0.4   worker0


➤ Create a pod that gets scheduled to specific node
So can also schedule a pod to one specific node via setting "nodeName".
